# $Id: PKGBUILD 82942 2013-01-26 01:37:20Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Georg Vogetseder <georg.vogetseder@gmail.com>

pkgname=hamster-time-tracker
pkgver=1.03.3
pkgrel=1
pkgdesc="Time tracking application that helps you to keep track on how much time you have spent during the day on activities you choose to track"
arch=('any')
url="http://projecthamster.wordpress.com/"
license=('GPL')
depends=('python2-dbus' 'python2-gconf' 'python2-notify' 'python2-wnck' 'python2-xdg' 'desktop-file-utils' 'hicolor-icon-theme' 'xdg-utils')
makedepends=('intltool' 'gnome-doc-utils')
provides=('hamster-applet')
conflicts=('hamster-applet')
replaces=('hamster-applet')
install=$pkgname.install
source=(https://github.com/projecthamster/hamster/archive/$pkgname-$pkgver.tar.gz)
sha256sums=('b98520bee8871f6d5944ba0ab8e71b834fd4f189b5d9f07838f22bb938227214')

build() {
  cd "$srcdir/hamster-$pkgname-$pkgver"

  # Python2 fix
  find . -type f | xargs sed -i 's@^#!.*python$@#!/usr/bin/python2@'

  python2 ./waf configure --prefix=/usr
  python2 ./waf build
}

package() {
  cd "$srcdir/hamster-$pkgname-$pkgver"

  python2 ./waf install --destdir=$pkgdir

  # Move bash completion and GConf schema to it's correct place
  install -dm755 "$pkgdir/usr/share/bash-completion/completions"
  mv "$pkgdir/etc/bash_completion.d/hamster.bash" "$pkgdir/usr/share/bash-completion/completions/hamster"
  mv "$pkgdir/etc/gconf" "$pkgdir/usr/share"
  rm -r "$pkgdir/etc"
}
